home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ShapeControlsLibrary.h
-
- Contains: library to allow the user to manipulate (gxTransform) a set of shapes
-
- Written By: Dave Good and Jeff Kreegar
-
- Copyright: ©1992-1995 by Apple Computer, Inc. All rights reserved.
-
- Change History (most recent first):
-
- <2> 1/9/95 JD changed 'boolean' to 'Boolean'
- <1> 1/9/95 JD First checked in.
-
- */
-
- #ifndef __SHAPECONTROLSLIBRARY__
- #define __SHAPECONTROLSLIBRARY__
-
- #include <Events.h>
- #include <GXTypes.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* for compatibility with old headers */
- #define shapeControlsLibraryIncludes
-
- /*
- | General Information:
- |
- | • The items gxShape passed in is used directly by the gxShape controls library; the application may modify or
- | look at it at any time. Note that if the application removes or adds a sub-gxShape (or changes a sub-gxShape
- | in any way) then it needs to call InvalidShapeControlShape on the sub-gxShape.
- |
- | • The foreground and background shapes are also used directly by the gxShape controls library and therefore
- | can be modified at any time (and also must be invalidated). The background gxShape appears underneath all
- | the items and the foreground gxShape appears above all the items, but below the control handles for the
- | current selection.
- |
- | • The foreground and background shapes will both be modified slightly to draw to the same list of viewPorts
- | that the items picture goes to. Other than this, they will not be changed.
- |
- | • GetShapeControlSelection and SetShapeControlSelection do NOT work directly with the selection picture
- | inside the gxShape control; instead GetShapeControlSelection returns a completely new picture that contains
- | all the sub-shapes of the item picture that are selected. The application must then dispose of this returned
- | picture when it is through with it. SetShapeControlSelection will select all the sub-shapes of the items
- | picture contained by shapesToSelect. The application may then dispose of this shapesToSelect picture. The
- | shapesToSelect parameter may be a single sub-gxShape instead of a picture, but it must always be contained
- | by the items picture.
- |
- | • GetShapeControlSelectionHandles returns a copy of the gxShape that is drawn as the selection’s handles.
- |
- | • SendEventToShapeControl returns true if it handled the event and false if it didn’t. The events handled are:
- | * keyDown: delete removes the item
- | * mouseDown: in a destination gxViewPort for the items picture, the selection will be tracked; any other
- | mouse event will return false.
- |
- | • InvalidateShapeControlShape does NOT require that invalidShape be a member of the items picture for the
- | gxShape control. However, if invalidShape is a member and it is selected, then the control handles will be
- | added to the invalid area also. An application should use this call when invalidating a picture containly
- | several widely separated disjoint areas; it should probably use InvalidateShapeControlRectangle to invalidate
- | other types of shapes.
- |
- | • UpdateShapeControl redraws all the invalid areas that have been recorded by calls to InvalidateShapeControlShape
- | and InvalidateShapeControlRectangle.
- |
- | • The gxShape controls library will try to allocate an offscreen buffer for each of the viewPorts that the items
- | picture draws into. If this buffer is allocated, then the manipulation of the sub-objects will be flicker-free.
- | If, on the other hand, there is not enough memory to allocate this buffer, then the gxShape controls library
- | will still work, but the objects will flicker quite a bit as they are manipulated.
- */
-
- typedef struct shapeControlRecord **shapeControl;
-
- shapeControl NewShapeControl(gxShape items, gxShape background, gxShape foreground);
- void DisposeShapeControl(shapeControl target);
-
- gxShape GetShapeControlSelection(const shapeControl source);
- void SetShapeControlsSelection(shapeControl target, gxShape shapesToSelect, Boolean bringToFront, Boolean replaceSelection);
- gxShape GetShapeControlSelectionHandles(const shapeControl source);
-
- Boolean SendEventToShapeControl(shapeControl target, EventRecord *event);
-
- void InvalidateShapeControlShape(shapeControl target, gxShape invalidShape);
- void InvalidateShapeControlRectangle(shapeControl target, gxRectangle *bounds);
-
- void UpdateShapeControl(shapeControl target);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __SHAPECONTROLSLIBRARY__ */
-